﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Drawing;
using System.Web.UI;
using System.Web.UI.WebControls;
using GrewalCRM.Entities;
using GrewalCRM.BLL;

public partial class CallLogEntry : System.Web.UI.Page
{
    CallLog_BLL callLogBll = new CallLog_BLL();

    #region Events
    protected void Page_Load(object sender, EventArgs e)
    {
      if (!Page.IsPostBack)
      {
        //PopulateDealer();
        //lblCallDateValue.Text = DateTime.Now.ToShortDateString();
      }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
      //int result;

      //CustomersMaster customer = new CustomersMaster(txtCustomerName.Text, txtAddress.Text, txtZipCode.Text, txtPhoneNo.Text, txtMobNo1.Text, txtMobNo2.Text, Master.SessionUser);



      //CallLog call = new CallLog(DateTime.Parse(lblCallDateValue.Text), new ReffCallType(int.Parse(ddlCallType.SelectedValue)),
      //                        new DealersMaster(int.Parse(ddlDealer.SelectedValue)), customer, null, new InstallersMaster(UCCallSatus.InstallerID),
      //                        null, txtComment.Text, new ReffStatus(UCCallSatus.CallStatusID), null,
      //                        UCdpACPurchaseDate.Date, txtModelNo.Text, txtSerialNo.Text,null,null,null,null,null,null,null, Master.SessionUser
      //                        );


      //result = callLogBll.Save(call);

      //if (result == 2627)
      //{
      //  lblNotification.Text = "Record failed to save. May be duplicate record. Check the AC serial No.";
      //  lblNotification.ForeColor = Color.Red;
      //}
      //else if (result != 0)
      //{
      //  lblNotification.Text = "Record save sucessfully with the Call ID = " + result.ToString();
      //  lblNotification.ForeColor = Color.Green;
      //}

    }
    protected void ddlCallType_SelectedIndexChanged(object sender, EventArgs e)
    {
      //ddlDealer.Enabled = !(int.Parse(ddlCallType.SelectedValue) > 1);

    } 
    #endregion

    #region Private Methods
    private void PopulateDealer()
    {
      //DealersMaster_BLL dealerBLL = new DealersMaster_BLL();
      //ddlDealer.DataSource = dealerBLL.GetAllDealer();
      //ddlDealer.DataTextField = "DealerCounterName";
      //ddlDealer.DataValueField = "ID";
      //ddlDealer.DataBind();
      //CommonUtil.AddDefaultItemToDDL(ddlDealer);

    } 
    #endregion
}